// action ->  mutation -> state
import * as types from '../types'
import { storeExpire } from '@/config/index'

const state = {
  list:[],
  currentWexin:null
}

const mutations = {
  [types.SET_WEIXIN_LIST](state, {data}){
    state.list = data;
  },
  [types.SET_CURRENT_WEIXIN](state, { data }){
    state.currentWexin = data;
  },
};

const actions = {
  setCurrentWeixin({commit}, data){
    commit(types.SET_CURRENT_WEIXIN, { __store: { expire: storeExpire }, data });
  },
  setWeixinList: ({ commit }, data) => {
    commit(types.SET_WEIXIN_LIST, { __store: { expire: storeExpire }, data })
  }
}

export default {
  state,
  mutations,
  actions
}
